
from django.contrib import admin
from repository import models

class AssetAdmin(admin.ModelAdmin):
    list_display = ('id','device_type_id','device_status_id','cabinet_num','idc','business_unit')
    search_fields = ['sn','idc','business_unit','tag']
    list_per_page = 10
    list_filter = ('idc','business_unit','tag',)

    # actions = ['delete_selects_row_']

    dynamic_fk = 'idc'

class ArticleDetailAdmin(admin.ModelAdmin):
    list_display = ('id','title')


class SessionTrackAdmin(admin.ModelAdmin):
    list_display = ('id','user','bind_host','date','cmd_count','stay_time')
    list_filter = ('user','bind_host','date')
    search_fields = ['user','bind_host']
    fk_fields = ('user','bind_host')
    list_per_page = 10
    choice_fields = ()

    # dynamic_fk = ('bind_host')
    # dynamic_list_display = ()
    # dynamic_choice_fields = ()

class AuditLogAdmin(admin.ModelAdmin):
    list_display = ('id','user','host','action_type','cmd','date')
    fk_fields = ('user','host')
    list_per_page = 10
    choice_fields = ('action_choices')



admin.site.register(models.Asset,AssetAdmin)
admin.site.register(models.Server)
admin.site.register(models.NetworkDevice)
admin.site.register(models.UserProfile)
admin.site.register(models.UserGroup)
# admin.site.register(models.AdminInfo)       #wu Sir administrator's table
admin.site.register(models.BusinessUnit)
admin.site.register(models.IDC)
admin.site.register(models.Tag)

admin.site.register(models.AssetRecord)
admin.site.register(models.ErrorLog)
admin.site.register(models.ArticleDetail,ArticleDetailAdmin)
admin.site.register(models.NewAssetApprovalZone)
admin.site.register(models.Manufactory)
admin.site.register(models.CPU)
admin.site.register(models.Disk)
admin.site.register(models.NIC)
admin.site.register(models.Memory)

admin.site.register(models.HostGroups)
# admin.site.register(models.RemoteUser)
admin.site.register(models.BindHosts)
admin.site.register(models.Task)
admin.site.register(models.TaskLogDetail)
admin.site.register(models.Token)
admin.site.register(models.SessionTrack)
admin.site.register(models.AuditLog)




